import { createRouter, createWebHistory, createWebHashHistory } from 'vue-router'
import HomeView from '../views/home/HomeView.vue'
import LoginView from '@/views/login/LoginView.vue'



import RegisterView from '@/views/register/RegisterView.vue'

import StartView from '@/views/start/StartView.vue'

import RegisterPath1 from '@/views/register/RegisterPath1.vue'

import RegisterPath2 from '@/views/register/RegisterPath2.vue'
import PwdView from '@/views/pwd/PwdView.vue'
import PwdPath1 from '@/views/pwd/PwdPath1.vue'
import DialogView from '@/views/dialog/DialogView.vue'
import FooterCom from '@/components/FooterCom.vue'
import MyView from '@/views/my/MyView.vue'
import CommunityView from '@/views/community/CommunityView.vue'
import PwdPath2 from '@/views/pwd/PwdPath2.vue'
import AddCommunityView from '@/views/community/AddCommunityView.vue'
import FanYiView from '@/views/fanyi/FanYiView.vue'

const router = createRouter({
  history: createWebHashHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      redirect: '/start',
    },
    {
      path: '/start',
      name: 'start',
      component: StartView,
    },
    {
      path: '/login',
      name: 'login',
      component: LoginView,
    },
    {
      path: '/register',
      name: 'register',
      redirect: '/register/path1',
      component: () => import('../views/register/RegisterView.vue'),
      children: [
        {
          path: 'path1',
          name: 'path1',
          component:() => import('../views/register/RegisterPath1.vue') ,
        },
        {
          path: 'path2',
          name: 'path2',
          component: () => import('../views/register/RegisterPath2.vue'),
        }
      ]
    },

    {
      path: '/pwd',
      redirect: '/pwd/Pwdpath1',
      component: () => import('../views/pwd/PwdView.vue'),
      children: [
        {
          path: 'Pwdpath1',
          name: 'Pwdpath1',
          component: () => import('../views/pwd/PwdPath1.vue'),

        },
        {
          path: 'Pwdpath2',
          name: 'Pwdpath2',
          component: () => import('../views/pwd/PwdPath2.vue'),
        },
      ]
    },
    {
      path: '/home',

      components: {
        default: HomeView,
        footercom: FooterCom,
      },
      meta: {
        title: '首页'
      }
    },
    {
      path: '/my',
      name: 'my',
      components: {
        default: MyView,
        footercom: FooterCom,
      },
      meta: {
        title: '我的'
      }
    },
    {
      path: '/collection',
      name: 'collection',
      components: {
        default: () => import('../views/my/CollectionView.vue'),
      },
    },
    {
      path: '/mission',
      name: 'mission',
      components: {
        default: () => import('../views/my/MissionView.vue'),
      },
    },
    {
      path: '/create',
      name: 'create',
      components: {
        default: () => import('../views/my/AddCreate.vue'),
      },
    },
    {
      path: '/editdata',
      name: 'editdata',
      components: {
        default: () => import('../views/my/EditData.vue'),
      },
    },
    {
      path: '/community',
      name: 'community',
      components: {
        default: CommunityView,
        footercom: FooterCom,
      },
      meta: {
        title: '社区'
      },
    },
    {
      path: '/community/addcommunity',
      name: 'addcommunity',
      components: {
        default: AddCommunityView, 
        // footercom: FooterCom,
      },
    },
    {
      path: '/dialog',
      name: 'dialog',
      components: {
        default: DialogView,
        footercom: FooterCom,
      },
      meta: {
        title: '对话'
      },
    },
    {
      path: '/fanyi',
      name: 'fanyi',
      components: {
        default:  () => import('../views/fanyi/FanYiView.vue'),
      },
    },
    {
      path: '/aiimage',
      name: 'aiimage',
      components: {
        default: () => import('../views/aimage/ImageView.vue'),
      },
    },
  

  ],
})

export default router
